'''
根据name 提供不同算法对象（layer1 （first is 1））
和业务逻辑无关
'''
import cv2
import numpy as np

# from algorithom.Yolov5_insSeg.insSeg_yolov5 import Inference as SegV5Inference
from algorithom.bar_pyzbar.bar import get_bar  # 条码识别
from algorithom.yolov8.user_det_predict import get_v8_detect_onepic  # v8 det
from algorithom.yolov8.user_seg_predict import get_yolov8_seg_predict # v8 seg infer




class AlgoFactory: #
    @staticmethod
    def create(class_type, **kwargs):
        # if class_type == "yolov5_seg":
        #     seg_yolov5 = get_seg_yolov5(model_path=kwargs.get('model_path',' '),
        #                                 input_h=kwargs.get('input_h', 416),
        #                                 input_w=kwargs.get('input_w', 416),
        #                                 conf=kwargs.get('conf', 0.25),
        #                                 iou=kwargs.get('iou', 0.45))
        #     return seg_yolov5
        if class_type == "yolov8_det":
            return get_v8_detect_onepic(
                model_path=kwargs.get('model_path', ' '),
            )
        elif class_type == "yolov8_seg":
            return get_yolov8_seg_predict(
                model_path=kwargs.get('model_path', ' '),
            )

        elif class_type == "bar_pyzbar":
            return get_bar
        else:
            raise ValueError("Invalid transport type")